﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using OpenQA;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium;

using OpenQA.Selenium.Support.UI;

using OpenQA.Selenium.Support;
using OpenQA.Selenium.Support.PageObjects;


namespace GmailTest
{
    public class Class1
    {
        [FindsBy(How = How.CssSelector, Using = ".email-label")]
        private IWebElement labeluserId;

        [FindsBy(How = How.CssSelector, Using = ".passwd-label")]
        private IWebElement labelpassword;
    

        [FindsBy(How = How.CssSelector, Using = "#Email")]
        private IWebElement userId;

        [FindsBy(How = How.CssSelector, Using = "#Passwd")]
        private IWebElement password;

        [FindsBy(How = How.CssSelector, Using = "#signIn")]
        private IWebElement btnsignIn;

        IWebDriver driver;
        
        [SetUp]

        public void SetUp()
        {
            driver = new FirefoxDriver();
           driver.Navigate().GoToUrl("https://www.gmail.com");
              PageFactory.InitElements(driver,this);
        }


        [Test,Category("Test1")]        
        public void ValidateLogin()
        {

            Assert.AreEqual("Username", labeluserId.Text);
            Assert.AreEqual("Password", labelpassword.Text);
            
        }

        [Test,Category("Test2")]        
        public void Login()
        {
            userId.SendKeys("Deeps");
            password.SendKeys("meow");
            btnsignIn.Click();
            Assert.IsTrue(true,"hiMeow");

        }

        [TearDown]
        public void TearDown()
        {
            driver.Quit();
        }

        //Select select = new Select(driver.FindElement(By.Id("select")));
        /*
        // Google's search is rendered dynamically with JavaScript.
        // Wait for the page to load, timeout after 10 seconds
         * 
        WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
        wait.Until((d) => { return d.Title.ToLower().StartsWith("cheese"); });
         * */

    }
}
